package org.shinetour.sms.controller;


import org.shinetour.sms.model.ResultModel;
import org.shinetour.sms.service.ISendSmsService;
import org.shinetour.sms.service.ISmsManageService;
import org.shinetour.sms.web.controller.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Map;

/**
 * @Description: 短信发送
 * @Author: ZhenHua Wang
 * @CreateDate: 2020/3/20 15:33
 */

@Controller
@RequestMapping("/sendSms")
public class SendSmsApiController extends BaseController {

    @Autowired
    ISmsManageService smsService;
    @Autowired
    ISendSmsService sendSmsService;


    /**
     * @Description: 通用短信发送接口
     * @Author: ZhenHua Wang
     * @CreateDate: 2020/4/1 14:49
     */
    @PostMapping("/sendSms")
    @ResponseBody
    public ResultModel sendSms(@RequestParam Map<String, String> map) {
        ResultModel res = new ResultModel();
        try {
            res = sendSmsService.sendSms(map);
        } catch (Exception ex) {
            return res.error(ex.getMessage());
        }
        return res;
    }
}
